package chpt3;

import java.util.*;

class Person{
	
	private static int count;
	private String name;
	private int age;  
	private boolean gender;
	private int id;
	
	public static int idsum = 0;
	static{
		System.out.println("This is static initialization block");
	}
	{
		System.out.println("This is initialization block, id is "+idsum);
		idsum++;
		id = idsum-1;
	}
	
public Person(){
		
		System.out.println("This is constructor");
		System.out.println(name+","+age+","+gender+","+id);
}

public Person(String name,int age,boolean gender){
		this.name = name;
		this.age = age;
		this.gender = gender; 
}
	


@Override
public String toString() {
	return "Person [name=" + name + ", age=" + age + ", gender=" + gender + ", id=" + id + "]";
}


public static int getCount(){
	return count;
}
public void setName(String name) {
	this.name = name;
}
public String getName() {
	return name;
}

public void setAge(int age) {
	this.age = age;
}

public int getAge() {
	return age;
}

public boolean setGender(){
	return  gender;
}

public int getId() {
	return id;
}

public void setId(int id) {
	this.id = id;
}

public static void setCount(int count){
	Person.count = count;
}
	
}

public  class MM2{

	    public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		Person[] persons = new Person[n];
		for(int j = 0;j < persons.length;j++){			
			Person person = new Person(in.next(),in.nextInt(),in.nextBoolean());
			persons[j] = person;
		}
		for(int i = persons.length-1; i>=0;i--){
			System.out.println(persons[i]);
		}
		System.out.println(new Person());
	}
}

